package com.wufan.day05.exer2;

/**
 * @author SongWufan
 * @date 2021/3/10 22:14
 */
public class Bank {
    /**
     * 存放多个客户的数组
     */
    private Customer[] customers;

    /**
     * 记录客户的个数
     */
    private int numberOfCustomers;

    public Bank() {
        this.customers = new Customer[10];
    }

    /**
     * 添加客户
     * @param f
     * @param l
     */
    public void addCustomer(String f, String l) {
        Customer customer = new Customer(f,l);
        customers[numberOfCustomers++] = customer;

    }

    /**
     * 获取客户个数
     * @return
     */
    public int getNumberOfCustomers() {
        return numberOfCustomers;
    }

    /**
     * 获取指定位置上的客户
     * @param index
     * @return
     */
    public Customer getCustomer(int index) {
        if (index >= 0 && index < numberOfCustomers){
            return customers[index];
        }
        return null;
    }


}
